﻿// ===============================================================================
// DotNet.Platform 开发框架 2016 版权所有
// ===============================================================================

using System;
using System.Web.Mvc;
using DotNet.JCore.Entity;
using DotNet.JCore.Service;
using DotNet.Extensions;
using DotNet.Helper;
using DotNet.Utility;
using DotNet.Web.Controllers;
using DotNet.Auth.Utility;

namespace DotNet.JCore.Controllers
{
    public class PointOffWorkController : BaseController
    {
        private PointOffWorkService service = new PointOffWorkService();

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Grid(string pointId, string startDate, string endDate)
        {
            var list = service.GetPageList(PageInfo(),pointId,
                startDate.ToDateTimeOrNull(), endDate.ToDateTimeOrNull());
            return View(list);
        }

        [HttpGet]
        public ActionResult Save()
        {
            PointOffWork entity = new PointOffWork();
            entity.Id = StringHelper.Guid();
            entity.PointId = CurrentEmployee.PointId;
            entity.PointName = CurrentEmployee.PointName;
            AuthHelper.SetJCUserInfo(entity, true);
            service.Insert(entity);
            return RedirectToAction("Logout", "Account", new { area = "AuthWeb" });
        }
    }
}
